<!DOCTYPE HTML>
<html lang="en-US" >
    
    <head>
        
        <meta charset="UTF-8">
        <title>Xcode模板修改 | </title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 1.0.3">
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    
    
    
    <link rel="next" href="../9.html" />
    
    
    <link rel="prev" href="../8.html" />
    

        
    </head>
    <body>
        
        
<link rel="stylesheet" href="../gitbook/style.css">


        
    <div class="book"  data-level="8" data-basepath=".." data-revision="1442487071738">
    

<div class="book-summary">
    <div class="book-search">
        <input type="text" placeholder="Type to search" class="form-control" />
    </div>
    <ul class="summary">
        
    	
    	
    	

        

        
    
        
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                        <i class="fa fa-check"></i>
                        
                         保持兴奋
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="1" data-path="nsstring/README.html">
            
                
                    <a href="../nsstring/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                         NSString 类介绍及用法
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="2" data-path="5.html">
            
                
                    <a href="../5.html">
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                         结构体成员变量
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="3" data-path="4.html">
            
                
                    <a href="../4.html">
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                         对象和方法之间的关系
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="4" data-path="pragma_mark/README.html">
            
                
                    <a href="../pragma_mark/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                         #pragma mark指令
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="5" data-path="6.html">
            
                
                    <a href="../6.html">
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                         对象作为方法的参数连续传递
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="6" data-path="oc/README.html">
            
                
                    <a href="../oc/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                         OC多文件开发介绍
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="7" data-path="8.html">
            
                
                    <a href="../8.html">
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                         匿名对象
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter active" data-level="8" data-path="xcode/README.html">
            
                
                    <a href="../xcode/README.html">
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                         Xcode模板修改
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="9" data-path="9.html">
            
                
                    <a href="../9.html">
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                         Xcode文档安装
                    </a>
                
            
            
        </li>
    


        
        <li class="divider"></li>
        <li>
            <a href="http://www.gitbook.io/" target="blank" class="gitbook-link">Published using GitBook</a>
        </li>
        
    </ul>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header">
    <!-- Actions Left -->
    <a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
    <a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
    
    <div id="font-settings-wrapper" class="dropdown pull-left">
        <a href="#" class="btn toggle-dropdown" aria-label="Toggle font settings"><i class="fa fa-font"></i>
        </a>
        <div class="dropdown-menu font-settings">
    <div class="dropdown-caret">
        <span class="caret-outer"></span>
        <span class="caret-inner"></span>
    </div>

    <div class="buttons">
        <button type="button" id="reduce-font-size" class="button size-2">A</button>
        <button type="button" id="enlarge-font-size" class="button size-2">A</button>
    </div>

    <div class="buttons font-family-list">
        <button type="button" data-font="0" class="button">Serif</button>
        <button type="button" data-font="1" class="button">Sans</button>
    </div>

    <div class="buttons color-theme-list">
        <button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">White</button>
        <button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">Sepia</button>
        <button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">Night</button>
    </div>
</div>

    </div>

    <!-- Actions Right -->
    
    <div class="dropdown pull-right">
        <a href="#" class="btn toggle-dropdown" aria-label="Toggle share dropdown"><i class="fa fa-share-alt"></i>
        </a>
        <div class="dropdown-menu font-settings dropdown-left">
            <div class="dropdown-caret">
                <span class="caret-outer"></span>
                <span class="caret-inner"></span>
            </div>
            <div class="buttons">
                <button type="button" data-sharing="twitter" class="button">Twitter</button>
                <button type="button" data-sharing="google-plus" class="button">Google</button>
                <button type="button" data-sharing="facebook" class="button">Facebook</button>
                <button type="button" data-sharing="weibo" class="button">Weibo</button>
                <button type="button" data-sharing="instapaper" class="button">Instapaper</button>
            </div>
        </div>
    </div>
    

    
    <a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Share on Google Plus"><i class="fa fa-google-plus"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Share on Facebook"><i class="fa fa-facebook"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Share on Twitter"><i class="fa fa-twitter"></i></a>
    
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" ></a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-gitbook_40">
                    
                        <h1 id="xcode">Xcode模板修改</h1>
<h2 id="">本小节知识点:</h2>
<ol>
<li>修改项目模板</li>
<li>修改类的头部信息</li>
</ol>
<hr>
<h2 id="1">1.修改项目模板</h2>
<ul>
<li><p>项目模板就是创建工程的时候选择的某一个条目, Xcode会根据选择的条目生成固定格式的项目</p>
<ul>
<li>例如想创建一个命令行项目就选择Command Line Tool
<img src="../images/a8/Snip20150529_35.png" alt=""></li>
</ul>
</li>
<li><p>如何修改项目模板</p>
<ul>
<li>1.应用程序中,找到Xcode, 右键&quot;显示包内容&quot;
<img src="../images/a8/Snip20150529_44.png" alt=""></li>
<li>打开&quot;/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project\ Templates/Mac/Application&quot; 文件夹<ul>
<li>在/Application文件夹中能够找到所有和OS X Application界面对应的文件夹
<img src="../images/a8/Snip20150529_36.png" alt=""></li>
</ul>
</li>
<li>修改Command Line Tool模板<ul>
<li>打开&quot;Command Line Tool.xctemplate&quot;文件夹, 发现和&quot;改Command Line Tool模板&quot;一一对应
<img src="../images/a8/Snip20150529_38.png" alt=""></li>
<li>打开&quot;TemplateInfo.plist文件&quot;发现和&quot;改Command Line Tool模板&quot;中内容对应
<img src="../images/a8/Snip20150529_39.png" alt=""></li>
<li>修改&quot;TemplateInfo.plist文件&quot;中的内容
<img src="../images/a8/Snip20150529_41.png" alt=""></li>
</ul>
</li>
</ul>
</li>
<li><p>注意:</p>
<ul>
<li>修改最好重启Xcode</li>
<li>如果发现不能修改, 可以将文件拖到桌面后再修改, 或者修改文件的权限后再修改
<img src="../images/a8/Snip20150529_40.png" alt=""></li>
</ul>
</li>
</ul>
<p><img src="../images/a8/Snip20150530_46.png" alt=""></p>
<p><img src="../images/a8/Snip20150530_49.png" alt=""></p>
<ul>
<li>练习: 修改main文件模板<ul>
<li>因为main文件是随着项目的创建自动创建的, 所以想要修改main文件的模板其实就是修改项目模板</li>
<li>同样打开&quot;TemplateInfo.plist文件&quot;找到对应数据后直接修改重启Xcode即可
+
<img src="../images/a8/Snip20150530_53.png" alt="">
<img src="../images/a8/Snip20150530_54.png" alt=""></li>
</ul>
</li>
</ul>
<hr>
<h2 id="2">2.修改类的头部信息</h2>
<ul>
<li>找到对应类对应的类文件模板. (因为类是创建项目之后手动创建的, 而不是随着项目的创建自动创建的, 所以修改类文件模板和项目模板并不是修改同一个文件)<ul>
<li>打开&quot;/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates File  Templates/Source/Cocoa Class.xctemplate&quot;文件夹</li>
</ul>
</li>
</ul>
<p><img src="../images/a8/Snip20150530_56.png" alt=""></p>
<pre><code>+ 找到继承Objective-C对应的文件夹
</code></pre><p><img src="../images/a8/Snip20150530_61.png" alt=""></p>
<pre><code>+ 修改对应的模板文件
</code></pre><p><img src="../images/a8/Snip20150530_58.png" alt=""></p>
<p><img src="../images/a8/Snip20150530_59.png" alt=""></p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../8.html" class="navigation navigation-prev " aria-label="Previous page: 匿名对象"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../9.html" class="navigation navigation-next " aria-label="Next page: Xcode文档安装"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="https://cdn.mathjax.org/mathjax/2.4-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-mathjax/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"fontSettings":{"theme":null,"family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
